package com.int_tech.data.service;

import com.int_tech.data.dao.DataInfoDao;
import com.int_tech.data.entity.DataInfo;
import com.int_tech.shebeiManager.dao.*;
import com.int_tech.shebeiManager.entity.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

/**
 * Created by liubch on 2018/6/10.
 */
@Service
public class DataService {
    @Autowired
    private DataInfoDao dataInfoDao;

    @Autowired
    private WenduDao wenduDao;

    @Autowired
    private ShiduDao shiduDao;

    @Autowired
    private ZuobiaoDao zuobiaoDao;

    @Autowired
    private ZhenDongXDao zhenDongXDao;

    @Autowired
    private ZhenDongYDao zhenDongYDao;

    @Autowired
    private ZhenDongZDao zhenDongZDao;

    @Autowired
    private YouliangDao youliangDao;

    public Page<DataInfo> findByShebeiId(int i, int i1, String shebeiId) {
        PageRequest pageRequest = new PageRequest(i - 1, i1);
        return dataInfoDao.findByShebeiId(pageRequest,shebeiId);
    }

    public Page<DataInfo> findByShebeiIdAndZhenTouOrderByCreateTimeDesc(int i, int i1, String shebeiId, String a0) {
        PageRequest pageRequest = new PageRequest(i - 1, i1);
        return dataInfoDao.findByShebeiIdAndZhenTouOrderByCreateTimeDesc(pageRequest,shebeiId,a0);
    }

    public Page<DataInfo> findByShebeiIdAndZhenTouOrderByCreateTimeAsc(int i, int i1, String shebeiId, String a1) {
        PageRequest pageRequest = new PageRequest(i - 1, i1);
        return dataInfoDao.findByShebeiIdAndZhenTouOrderByCreateTimeAsc(pageRequest,shebeiId,a1);
    }

    public Page<Wendu> findWenduByShebeiIdOrderByCreateTimeDesc(int i, int i1, String shebeiId) {
        PageRequest pageRequest = new PageRequest(i - 1, i1);
        return wenduDao.findWenduByShebeiIdOrderByCreateTimeDesc(pageRequest,shebeiId);
    }

    public Page<Shidu> findShiduByShebeiIdOrderByCreateTimeDesc(int i, int i1, String shebeiId) {
        PageRequest pageRequest = new PageRequest(i - 1, i1);
        return shiduDao.findShiduByShebeiIdOrderByCreateTimeDesc(pageRequest,shebeiId);
    }

    public Page<Zuobiao> findZuobiaoByShebeiIdOrderByCreateTimeDesc(int i, int i1, String shebeiId) {
        PageRequest pageRequest = new PageRequest(i - 1, i1);
        return zuobiaoDao.findZuobiaoByShebeiIdOrderByCreateTimeDesc(pageRequest,shebeiId);
    }

    public Page<ZhendongX> findZhendongXByShebeiIdOrderByCreateTimeDesc(int i, int i1, String shebeiId) {
        PageRequest pageRequest = new PageRequest(i - 1, i1);
        return zhenDongXDao.findZhenDongXByShebeiIdOrderByCreateTimeDesc(pageRequest,shebeiId);
    }

    public Page<ZhendongY> findZhendongYByShebeiIdOrderByCreateTimeDesc(int i, int i1, String shebeiId) {
        PageRequest pageRequest = new PageRequest(i - 1, i1);
        return zhenDongYDao.findZhenDongYByShebeiIdOrderByCreateTimeDesc(pageRequest,shebeiId);
    }

    public Page<ZhendongZ> findZhendongZByShebeiIdOrderByCreateTimeDesc(int i, int i1, String shebeiId) {
        PageRequest pageRequest = new PageRequest(i - 1, i1);
        return zhenDongZDao.findZhenDongZByShebeiIdOrderByCreateTimeDesc(pageRequest,shebeiId);
    }

    public Page<Youliang> findYouliangByShebeiIdOrderByCreateTimeDesc(int i, int i1, String shebeiId) {
        PageRequest pageRequest = new PageRequest(i - 1, i1);
        return youliangDao.findYouliangByShebeiIdOrderByCreateTimeDesc(pageRequest,shebeiId);
    }

    /*public Page<DataInfo> findByShebeiIdAndZhenTouOrderByCreateTimeDesc(int i, int i1, String shebeiId, String a0) {
        PageRequest pageRequest = new PageRequest(i - 1, i1);
        return dataInfoDao.findByShebeiIdAndZhenTou(pageRequest,shebeiId,a0);
    }*/
}
